package cn.good.yan.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 演示：网关
 *
 * @author shengren.yan
 * @create 2023-12-27
 */
@RestController
@RequestMapping("/t2")
@Slf4j
public class T2Controller {

    @Value("${server.port}")
    private String serverPort;

    // 1 正常的请求 地址1
    @GetMapping("/test1/{id}")
    public String test1(@PathVariable("id") Integer id) {
        log.info("网关正常请求1" + id);
        return id + " ok 端口：" + serverPort;
    }

    // 2 正常的请求 地址2
    @GetMapping("/test2")
    public String test2() {
        log.info("网关正常请求2");
        return  "第二请求 ok 端口" + serverPort;
    }


}
